/*
 * bmp_encoder.h
 *
 *  Created on: 2012-12-2
 *      Author: seemrain
 */

#ifndef BMP_ENCODER_H_
#define BMP_ENCODER_H_

//bmp file format:

#pragma pack(1)
typedef struct {
  unsigned char magic[2];
  unsigned int filesz;
  unsigned short creator1;
  unsigned short creator2;
  unsigned int bmp_offset;
} BITMAPFILEHEAD;

typedef enum {
  BI_RGB = 0,
  BI_RLE8,
  BI_RLE4,
  BI_BITFIELDS, //Also Huffman 1D compression for BITMAPCOREHEADER2
  BI_JPEG,      //Also RLE-24 compression for BITMAPCOREHEADER2
  BI_PNG,
} bmp_compression_method_t;



typedef struct {
  unsigned int header_sz;
  int width;
  int height;
  unsigned short nplanes;
  unsigned short bitspp;
  unsigned int compress_type;
  unsigned int bmp_bytesz;
  int hres;
  int vres;
  unsigned int ncolors;
  unsigned int nimpcolors;
} BITMAPINFOHEADER;

typedef struct _bmp_info{
	unsigned char *pixel_array;
	unsigned int width;
	unsigned int height;
	unsigned int bpp;
	unsigned int order;
	unsigned int stuff;
}BMPINFO;

BMPINFO *bmp_getinfo(unsigned char *header);

#endif /* BMP_ENCODER_H_ */
